package com.clouds.wms.dao;

import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import com.clouds.wms.bean.Cmspda;
import com.clouds.wms.exception.DatabaseException;
@Repository("cmspdaDao")
public class CmspdaDaoImpl implements CmspdaDao {
	private Log log = LogFactory.getLog(getClass());
	
	@Resource(name="namedParameterJdbcTemplate")
	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
	@Override
	public List<Cmspda> getAllCmspdaList() throws DatabaseException {
		String sql = "SELECT * FROM cmspda ORDER BY daaa ASC";
		try {
			return namedParameterJdbcTemplate.getJdbcOperations().query(sql, new BeanPropertyRowMapper<Cmspda>(Cmspda.class));
		} catch (Exception e) {
			log.error("exception :", e);
			throw new DatabaseException(e.getMessage());
		}
	}

}
